package com.marvels.approve.process.consum.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.marvels.approve.process.consum.ConsumerExternalFacesigApi;
import com.marvels.approve.process.dto.ApiResponse;
import com.marvels.approve.process.dto.KimGeXinQianInfo;
import com.marvels.approve.process.dto.ResignExternalDTO;
import com.marvels.common.utils.MarvelsLogUtil;
import com.marvels.dubbo.externalservice.service.PushFaceseSigService;
import com.marvels.dubbo.externalservice.service.SendSmsService;

import net.sf.json.JSONObject;

@Component
public class ConsumerExternalFacesigImpl implements ConsumerExternalFacesigApi{

	@Autowired
	private PushFaceseSigService pushFaceSigService;
	
	@Autowired
	private SendSmsService smsService;
	
	
	@Override
	public String pushFacePush(Map<String, String> map) {
		try {
			String result = pushFaceSigService.pushFacePush(map);
			MarvelsLogUtil.getInstance().info("ConsumerExternalFacesigApi.pushFacePush direct call success!");
			return result;
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("ConsumerExternalFacesigApi.pushFacePush error", e);
			return null;
		}
	}

	@Override
	public String sendSms(JSONObject json) {
		try {
			String result = smsService.sendSms(json);
			MarvelsLogUtil.getInstance().info("ConsumerExternalFacesigApi.sendSms direct call success!");
			return result;
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("ConsumerExternalFacesigApi.sendSms error", e);
			return null;
		}
	}

	@Override
	public ApiResponse<KimGeXinQianInfo> contractInitiationByPdfNew(ResignExternalDTO resignExternalDTO) {
		try {
			/*com.marvels.dubbo.externalservice.dto.ResignExternalDTO param = new com.marvels.dubbo.externalservice.dto.ResignExternalDTO();
			BeanUtil.copyProperties(resignExternalDTO, param);
			com.fintech.common.util.ApiResponse<com.fintech.third.model.kimge.KimGeXinQianInfo> apiResult = KimGeSignService.contractInitiationByPdfNew(param);*/
			ApiResponse<KimGeXinQianInfo> result = null;//(ApiResponse<KimGeXinQianInfo>) 
					//JSON.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(apiResult), new TypeReference<ApiResponse<KimGeXinQianInfo>>(){});
			MarvelsLogUtil.getInstance().info("ConsumerExternalFacesigApi.contractInitiationByPdfNew direct call success!");
			return result;
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("ConsumerExternalFacesigApi.contractInitiationByPdfNew error", e);
			return null;
		}
	}

	@Override
	public ApiResponse<KimGeXinQianInfo> getContractInitiationV2(ResignExternalDTO resignExternalDTO) {
		try {
			/*com.marvels.dubbo.externalservice.dto.ResignExternalDTO param = new com.marvels.dubbo.externalservice.dto.ResignExternalDTO();
			BeanUtil.copyProperties(resignExternalDTO, param);
			com.fintech.common.util.ApiResponse<com.fintech.third.model.kimge.KimGeXinQianInfo> apiResult = KimGeSignService.contractInitiationV2(param);*/
			ApiResponse<KimGeXinQianInfo> result = null;//(ApiResponse<KimGeXinQianInfo>) 
					//JSON.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(apiResult), new TypeReference<ApiResponse<KimGeXinQianInfo>>(){});
			MarvelsLogUtil.getInstance().info("ConsumerExternalFacesigApi.getContractInitiationV2 direct call success!");
			return result;
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("ConsumerExternalFacesigApi.getContractInitiationV2 error", e);
			return null;
		}
	}

	@Override
	public ApiResponse<String> getContractSignatureV2(ResignExternalDTO resignExternalDTO) {
		try {
			/*com.marvels.dubbo.externalservice.dto.ResignExternalDTO param = new com.marvels.dubbo.externalservice.dto.ResignExternalDTO();
			BeanUtil.copyProperties(resignExternalDTO, param);
			com.fintech.common.util.ApiResponse<String> apiResult = KimGeSignService.ContractSignatureV2(param);*/
			ApiResponse<String> result = null;//(ApiResponse<String>) 
					//JSON.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(apiResult), new TypeReference<ApiResponse<String>>(){});
			MarvelsLogUtil.getInstance().info("ConsumerExternalFacesigApi.getContractSignatureV2 direct call success!");
			return result;
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("ConsumerExternalFacesigApi.getContractSignatureV2 error", e);
			return null;
		}
	}

	@Override
	public ApiResponse<String> getDownloadDocuments(ResignExternalDTO resignExternalDTO) {
		try {
			/*com.marvels.dubbo.externalservice.dto.ResignExternalDTO param = new com.marvels.dubbo.externalservice.dto.ResignExternalDTO();
			BeanUtil.copyProperties(resignExternalDTO, param);
			com.fintech.common.util.ApiResponse<String> apiResult = KimGeSignService.downloadDocuments(param);*/
			ApiResponse<String> result = null;//(ApiResponse<String>) 
					//JSON.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(apiResult), new TypeReference<ApiResponse<String>>(){});
			MarvelsLogUtil.getInstance().info("ConsumerExternalFacesigApi.getDownloadDocuments direct call success!");
			return result;
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("ConsumerExternalFacesigApi.getDownloadDocuments error", e);
			return null;
		}
	}

}
